﻿<UserControl x:Class="Flare.Pages.General.Room" 
             xmlns:Controls="clr-namespace:Flare.Controls"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" xmlns:base="clr-namespace:Flare.DB" 
             d:DesignHeight="600" d:DesignWidth="800">
   
    <UserControl.Resources>
        <ObjectDataProvider x:Key="general_departmentsDataSet" ObjectType="{x:Type base:general_departments}" 
                            MethodName="Index" IsAsynchronous="False"/>

        <ObjectDataProvider x:Key="general_roomsDataSet" ObjectType="{x:Type base:general_rooms}" MethodName="Index2">
            <ObjectDataProvider.MethodParameters>
                <x:NullExtension/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </UserControl.Resources>

    <DockPanel LastChildFill="False" VerticalAlignment="Top">
        <Controls:FlameMenu x:Name="department" Caption="Отдел" DockPanel.Dock="Top" SelectedValuePath="id_department" DisplayMemberPath="department" 
                  ItemsSource="{Binding Source={StaticResource general_departmentsDataSet}}" SelectionChanged="department_SelectionChanged" />

        <Controls:FlameTbox x:Name="RoomName" DockPanel.Dock="Top" Margin="10,20,0,0" Text="{Binding SelectedItem.room, ElementName=RoomList}" 
                            Header="Комната" HorizontalAlignment="Left" Width="600"  />

        <StackPanel Orientation="Horizontal" Margin="10,40,0,40" DockPanel.Dock="Top">
            <Button x:Name="ButtonAdd" Content="Добавить" HorizontalAlignment="Left" Click="ButtonAdd_Click" />
            <Button x:Name="ButtonSave" Content="Сохранить" HorizontalAlignment="Left" Margin="8,0,0,0" Click="ButtonSave_Click" Visibility="Collapsed" />
            <Button x:Name="ButtonDelete" Content="Удалить" HorizontalAlignment="Left" Margin="8,0,0,0" Click="ButtonDelete_Click" Visibility="Collapsed" />
            <Button x:Name="ButtonClose" Content="Отмена" HorizontalAlignment="Left" Margin="8,0,0,0" Click="ButtonClose_Click" Visibility="Collapsed" />
        </StackPanel>

        <ListBox x:Name="RoomList" DockPanel.Dock="Top" ItemsSource="{Binding Source={StaticResource general_roomsDataSet}}" 
                 ItemContainerStyle="{StaticResource PrimitiveItemTemplate}" DisplayMemberPath="room" SelectedValuePath="id_room" HorizontalAlignment="Stretch" 
                 Style="{StaticResource StyleListBox}" SelectionChanged="RoomList_SelectionChanged">
        </ListBox>
    </DockPanel>
</UserControl>
